@extends('admin::layouts.master')
@section('content')
    <div class="card" id="app">
        <div class="card-header">货物管理</div>
        <ul role="tablist" class="nav nav-tabs">
            <li class="nav-item"><a href="/buy/huowu/{{$good->id}}" class="nav-link">货物列表</a></li>
            <li class="nav-item"><a href="#" class="nav-link active">添加货物</a></li>
        </ul>
        <form action="/buy/huowu/{{$good->id}}" method="post">
            <div class="card-body card-body-contrast">
                @csrf

<div class="form-group row">
    <label for="kucun" class="col-12 col-sm-3 col-form-label text-md-right">货物库存</label>
    <div class="col-12 col-md-9">
        <input id="kucun" name="kucun" type="text"
               value="{{ $huowu['kucun']??old('kucun') }}"
               class="form-control form-control-sm form-control{{ $errors->has('kucun') ? ' is-invalid' : '' }}">
        @if ($errors->has('kucun'))
            <span class="invalid-feedback" role="alert">
                <strong>{{ $errors->first('kucun') }}</strong>
            </span>
        @endif
    </div>
</div>
<div class="form-group row">
    <label for="fujiaprice" class="col-12 col-sm-3 col-form-label text-md-right">附加价格</label>
    <div class="col-12 col-md-9">
        <input id="fujiaprice" name="fujiaprice" type="text"
               value="{{ $huowu['fujiaprice']??old('fujiaprice') }}"
               class="form-control form-control-sm form-control{{ $errors->has('fujiaprice') ? ' is-invalid' : '' }}">
    </div>
</div>


                {{--属性组合--}}
                    @foreach($att as $v)
                    <div class="form-group row pt-1">
                        <label class="col-12 col-sm-3 col-form-label text-sm-right">
                            {{$v['name']}}
                        </label>
                        <div class="col-12 col-sm-8 col-lg-3">
                            <select name="attr[]" id="brand" class="form-control">
                                @foreach($v['_data'] as $vv)
                                    <option value="{{$vv['id']}}">{{$vv['name']}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                        @endforeach
            </div>
            <div class="card-footer text-muted">
                <button class="btn btn-primary offset-sm-2">保存提交</button>
            </div>
        </form>
    </div>
@endsection
